<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:c="http://xmlns.jcp.org/jsf/composite"
	xmlns:p="http://primefaces.org/ui">

<ui:decorate template="/jsp/WEB/pageLayout.xhtml">
	<ui:define name="centro">
		<h:form id="form">

			<p:panel id="RelPed" header="Gerenciar Pedidos">
				<f:facet name="actions">

					<h:commandLink
						styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default" title="Ajuda"
						onclick="dlg.show(); return false;">
						<h:outputText styleClass="ui-icon ui-icon-help" />
					</h:commandLink>

					<h:commandLink
						styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default"
						style="width:16px;heigh:16px;">
						<p:graphicImage style=" margin-top:1px;margin-left:2px"
							title="Exportar relatório para excel" url="/imagens/ui-xls.png"></p:graphicImage>
						<p:dataExporter type="xls" target="tabelaUsu"
							fileName="Lista de Impressão" />
					</h:commandLink>

				</f:facet>

				<p:dialog header="Ajuda" widgetVar="dlg">
					<h:outputText value="#{ImpressaoBean.help}" escape="false" />
				</p:dialog>

				<p:messages id="messages" showDetail="true" autoUpdate="true"
					closable="true" />
				<p:focus for="serie" />
				<h:panelGrid columns="3">
					<p:selectOneMenu value="#{ImpressaoBean.tpConsulta}">
						<f:selectItem itemLabel="Reimpressão" itemValue="reimprimir" />
						<f:selectItem itemLabel="Cancelamento" itemValue="cancelar" />
					</p:selectOneMenu>
					<p:inputText id="serie" value="#{ImpressaoBean.numPedidos}"
						title="Info: Digite aqui o(s) número(s) do(s) pedido(s) a ser cancelado(s)/reimpresso(s). Exemplo: 1001;1002"
						style="width: 185px; left:auto; margin-right:3px;" />
					<p:commandButton update="tabelaUsu" ajax="false" value="Executar"
						title="Executar" actionListener="#{ImpressaoBean.execute()}" />
				</h:panelGrid>

				<h:outputLabel value="Ex:1001;1002;1003"
					style="font-size: 9px; margin-left:14%; margin-top:0px" />

				<p:dataTable id="tabelaUsu" value="#{ImpressaoBean.rel}" var="rel"
					widgetVar="relImpressao" rowIndexVar="rowIndex"
					emptyMessage="Nenhum registro encontrado"
					style="margin-top:10px; position: auto" paginator="true" rows="20"
					rowsPerPageTemplate="10,20,30,40,50"
					filteredValue="#{ImpressaoBean.impFiltrados}">

					<f:facet name="header">
						<p:outputPanel>
							<h:outputText value="Buscar todos os campos:" />
							<p:inputText id="globalFilter"
								onkeyup="PF('relImpressao').filter()" style="width:150px"
								placeholder="Digite a palavra" />
						</p:outputPanel>
					</f:facet>


					<p:column filterBy="#{rel.idOrder}" sortBy="idOrder"
						headerText="Id Pedido" filterMatchMode="contains">
						<h:outputText value="#{rel.idOrder}" />
					</p:column>


					<p:column filterBy="#{rel.idOrderItem}" sortBy="idOrderItem"
						headerText="Id item pedido" filterMatchMode="contains">
						<h:outputText value="#{rel.idOrderItem}" />
					</p:column>

					<p:column filterBy="#{rel.idOrderItem}" sortBy="dateSendPrint"
						headerText="Data de envio" filterMatchMode="contains">
						<h:outputText value="#{rel.dateSendPrint}">
							<f:convertDateTime locale="pt_BR" pattern="dd/MM/yyyy" />
						</h:outputText>
					</p:column>

					<p:column filterBy="#{rel.hourSendPrint}" sortBy="hourSendPrint"
						headerText="Hora de envio" filterMatchMode="contains">
						<h:outputText value="#{rel.hourSendPrint}" />
					</p:column>

					<p:column filterBy="#{rel.statusPrint}" sortBy="statusPrint"
						headerText="Status" filterMatchMode="contains">
						<h:outputText value="Impresso" rendered="#{rel.statusPrint}" />
						<h:outputText value="Não impresso"
							rendered="#{not rel.statusPrint}" />
					</p:column>

					<p:column filterBy="#{rel.hourPrint}" sortBy="hourPrint"
						headerText="Hora Impressão" filterMatchMode="contains">
						<h:outputText value="#{rel.hourPrint}" />
					</p:column>

					<p:column filterBy="#{rel.itemCancel}" sortBy="itemCancel"
						headerText="Cancelamento" filterMatchMode="contains">
						<h:outputText value="Sim" rendered="#{rel.itemCancel}" />
						<h:outputText value="Não" rendered="#{not rel.itemCancel}" />
					</p:column>

					<p:column filterBy="#{rel.obs}" sortBy="obs"
						headerText="Observações" filterMatchMode="contains">
						<h:outputText value="#{rel.obs}" />
					</p:column>
				</p:dataTable>
			</p:panel>

		</h:form>
	</ui:define>
</ui:decorate>

</html>